'use strict'
const port = process.env.port || process.env.npm_config_port || 9099 // dev port
module.exports = {
  // cdn 库
  // https://cdn.jsdelivr.net/gh/xiaodingfeng/thea-res@latest/chat/dist/
  publicPath: process.env.NODE_ENV === 'development' ? '/' : '',
  outputDir: 'dist',
  assetsDir: 'static',
  lintOnSave: process.env.NODE_ENV === 'development',
  productionSourceMap: false,
  devServer: {
    port: port,
    client: {
      overlay: false
    },
    proxy: {
      '/api': {
        target: 'http://localhost:8085/',
        changeOrigin: true,
        pathRewrite: {
          '^/api': '/'
        }
      }
    }
  },
  configureWebpack: config => {
    // 生产环境移除console.log
    console.log(process.env.NODE_ENV, '---process.env.NODE_ENV')
    if (process.env.NODE_ENV === 'production') {
      config.optimization.minimizer[0].options.terserOptions.compress.drop_console = true
    }
  }
}
